package com.mdxx.xczd.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.mdxx.xczd.bean.MessageEvent;
import com.mdxx.xczd.utils.NetworkUtil;
import org.greenrobot.eventbus.EventBus;

public class NetworkReceiver extends BroadcastReceiver {
	private final static int NET_UNKNOWN = 0x06;
	private final static int WIFI = 0x05;
	private final static int NET_4G = 0x04;
	private final static int NET_3G = 0x03;
	private final static int NET_2G = 0x02;	
	private final static int NET_NONE = 0x00;

	@Override
	public void onReceive(Context context, Intent intent) {		
		switch (NetworkUtil.getCurrentNetworkType()) {
		/*case WIFI:*/
			/*EventBus.getDefault().post(new MessageEvent(null, null, 4));*/
		case NET_4G:
		case NET_3G:         //上传数据				
			EventBus.getDefault().post(new MessageEvent(null, null, 2));
			break;
			
		case NET_2G:
		case NET_UNKNOWN:
		case NET_NONE:     //缓存数据
			EventBus.getDefault().post(new MessageEvent(null, null, 2));
			break;
		default:
			break;
		}
	}
}
